package com.alibaba.citrus.ots.price.ability.functions.factory.activity;

import com.alibaba.citrus.ots.common.util.SpringContextUtil;
import com.alibaba.citrus.ots.price.ability.functions.entity.activity.ActivityTitleEntity;
import com.alibaba.citrus.ots.price.ability.functions.entity.activity.ActivityTitleExtEntity;
import com.alibaba.citrus.ots.price.repository.ActivityQueryRepository;
import com.epoch.app.otspricecenter.sdo.ActivityTitleExtSDO;

/**
 * @author: qiaojiange
 * @create: 2021/10/17
 * @Description 活动抬头扩展工厂
 */
public class ActivityTitleExtFactory {

    private static ActivityQueryRepository queryRepository = SpringContextUtil.getBean(ActivityQueryRepository.class);

    /**
     * 创建活动抬头扩展实体
     *
     * @param titleEntity
     * @return
     */
    public static ActivityTitleExtEntity create(ActivityTitleEntity titleEntity) {
        ActivityTitleExtSDO sdo = queryRepository.queryTitleExt(titleEntity.obtainActivityNoteId());
        return ActivityTitleExtEntity.of(sdo);
    }
}
